package com.twu.biblioteca;

public class Menu {
    public static final String AVAILABLE_OPTIONS_HEADER = "\nAvailable Options:";
    private final Printer printer;
    private final MenuParser parser;
    private final Library library;

    public Menu(Printer printer, MenuParser parser, Library library) {
        this.printer = printer;
        this.parser = parser;
        this.library = library;
    }

    private void printOptions() {
        printer.print(AVAILABLE_OPTIONS_HEADER);
        printer.print("1. List of Books");
    }

    public void go() {
        printOptions();
        System.out.print("Please choose: ");
        final MenuOption option = parser.userOption();
        if (option == MenuOption.List_Books) {
            library.printBooksOwned();
        }
    }
}
